/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author ivanhoe
 */
@Entity
@Table(name = "tipos_id")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TiposId.findAll", query = "SELECT t FROM TiposId t"),
    @NamedQuery(name = "TiposId.findByIdTipoId", query = "SELECT t FROM TiposId t WHERE t.idTipoId = :idTipoId"),
    @NamedQuery(name = "TiposId.findByNombreTipoId", query = "SELECT t FROM TiposId t WHERE t.nombreTipoId = :nombreTipoId")})
public class TiposId implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "id_tipo_id")
    private Integer idTipoId;
    @Size(max = 8)
    @Column(name = "nombre_tipo_id")
    private String nombreTipoId;
    @JoinColumn(name = "paises_id_pais", referencedColumnName = "id_pais")
    @ManyToOne(optional = false)
    private Paises paisesIdPais;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tiposIdIdTipoId")
    private Collection<Clientes> clientesCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tiposIdIdTipoId")
    private Collection<Proveedores> proveedoresCollection;

    public TiposId() {
    }

    public TiposId(Integer idTipoId) {
        this.idTipoId = idTipoId;
    }

    public Integer getIdTipoId() {
        return idTipoId;
    }

    public void setIdTipoId(Integer idTipoId) {
        this.idTipoId = idTipoId;
    }

    public String getNombreTipoId() {
        return nombreTipoId;
    }

    public void setNombreTipoId(String nombreTipoId) {
        this.nombreTipoId = nombreTipoId;
    }

    public Paises getPaisesIdPais() {
        return paisesIdPais;
    }

    public void setPaisesIdPais(Paises paisesIdPais) {
        this.paisesIdPais = paisesIdPais;
    }

    @XmlTransient
    public Collection<Clientes> getClientesCollection() {
        return clientesCollection;
    }

    public void setClientesCollection(Collection<Clientes> clientesCollection) {
        this.clientesCollection = clientesCollection;
    }

    @XmlTransient
    public Collection<Proveedores> getProveedoresCollection() {
        return proveedoresCollection;
    }

    public void setProveedoresCollection(Collection<Proveedores> proveedoresCollection) {
        this.proveedoresCollection = proveedoresCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idTipoId != null ? idTipoId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TiposId)) {
            return false;
        }
        TiposId other = (TiposId) object;
        if ((this.idTipoId == null && other.idTipoId != null) || (this.idTipoId != null && !this.idTipoId.equals(other.idTipoId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.TiposId[ idTipoId=" + idTipoId + " ]";
    }
    
}
